package com.px.chapter_Dec_1.textt;

public class IdNumber {
    private String iD;



    public IdNumber(String iD) {
        this.iD = iD;
    }
    public void getInformation(){
        if (iD.length()<=18){
            System.out.println("生日："+"\n"+iD.substring(6,10)+"年");
            System.out.println(iD.substring(10,12)+"月"+"\t"+iD.substring(12,14)+"日");
            System.out.print("性别为:");
            System.out.println((iD.charAt(16)-48)%2==0?"女":"男");
        }else System.out.println("输入错误");
    }

    @Override
    public String toString() {
        return "IdNumber{" +
                "iD='" + iD + '\'' +
                '}';
    }

    public String getiD() {
        return iD;
    }

    public void setiD(String iD) {
        this.iD = iD;
    }
}
